package dao.pojo;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name = "teacher", catalog = "makeiteasy")
public class Teacher implements java.io.Serializable {

	// Fields
	private static final long serialVersionUID = 1L;
	private Integer teaId;
	private String teaEmail;
	private String teaPassword;
	private String teaName;
	private Set<Test> tests = new HashSet<Test>(0);
	private Set<Classes> classeses = new HashSet<Classes>(0);
	private Set<Exam> exams = new HashSet<Exam>(0);
	private Set<Homework> homeworks = new HashSet<Homework>(0);
	private Set<Quiz> quizs = new HashSet<Quiz>(0);

	// Constructors

	/** default constructor */
	public Teacher() {
	}

	/** minimal constructor */
	public Teacher(String teaEmail, String teaPassword) {
		this.teaEmail = teaEmail;
		this.teaPassword = teaPassword;
	}

	/** full constructor */
	public Teacher(String teaEmail, String teaPassword, String teaName,
			Set<Test> tests, Set<Classes> classeses, Set<Exam> exams,
			Set<Homework> homeworks, Set<Quiz> quizs) {
		this.teaEmail = teaEmail;
		this.teaPassword = teaPassword;
		this.teaName = teaName;
		this.tests = tests;
		this.classeses = classeses;
		this.exams = exams;
		this.homeworks = homeworks;
		this.quizs = quizs;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "teaId", unique = true, nullable = false)
	public Integer getTeaId() {
		return this.teaId;
	}

	public void setTeaId(Integer teaId) {
		this.teaId = teaId;
	}

	@Column(name = "teaEmail", nullable = false, length = 50)
	public String getTeaEmail() {
		return this.teaEmail;
	}

	public void setTeaEmail(String teaEmail) {
		this.teaEmail = teaEmail;
	}

	@Column(name = "teaPassword", nullable = false, length = 20)
	public String getTeaPassword() {
		return this.teaPassword;
	}

	public void setTeaPassword(String teaPassword) {
		this.teaPassword = teaPassword;
	}

	@Column(name = "teaName", length = 50)
	public String getTeaName() {
		return this.teaName;
	}

	public void setTeaName(String teaName) {
		this.teaName = teaName;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "teacher")
	public Set<Test> getTests() {
		return this.tests;
	}

	public void setTests(Set<Test> tests) {
		this.tests = tests;
	}
	
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "teacher")
	public Set<Classes> getClasseses() {
		return this.classeses;
	}

	public void setClasseses(Set<Classes> classeses) {
		this.classeses = classeses;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "teacher")
	public Set<Exam> getExams() {
		return this.exams;
	}

	public void setExams(Set<Exam> exams) {
		this.exams = exams;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "teacher")
	public Set<Homework> getHomeworks() {
		return this.homeworks;
	}

	public void setHomeworks(Set<Homework> homeworks) {
		this.homeworks = homeworks;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "teacher")
	public Set<Quiz> getQuizs() {
		return this.quizs;
	}

	public void setQuizs(Set<Quiz> quizs) {
		this.quizs = quizs;
	}

}